<?php
/**
 * [WeEngine System] Copyright (c) 2014 WE7.CC
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
load()->model('payment');
load()->model('account');

$dos = ['display'];
$do = in_array($do, $dos) ? $do : 'display';
permission_check_account_user('publish_setting');

if ('display' == $do) {
	$account = [
		'serviceUrl' => $_W['siteroot'] . "api.php?id=" . $_W['account']['acid'],
		'token' => $_W['account']['token'],
		'encodingaeskey' => $_W['account']['encodingaeskey'],
		'isconnect' => $_W['account']['isconnect'],
		'ipwhitelist' => gethostbyname($_SERVER['HTTP_HOST'])
	];
	if (!empty($_W['account']['link'])) {
		$account_api = WeAccount::createByUniacid();
		$result = $account_api->getAccessToken();
		if (!is_error($result)) {
			$account['ipwhitelist'] = '';
		}
	}
}

template('profile/publish');
